package com.gitee.wsl.reflect.func.call.exception

import com.gitee.wsl.reflect.func.FunctionParameter
import com.gitee.wsl.reflect.func.call.FunctionCall
import com.gitee.wsl.reflect.func.call.FunctionCallArgument

/**
 * An exception thrown if a parameter-argument pair of a function call has incompatible types.
 * @param call the invalid call
 */
class MismatchingArgumentTypeException(
    call: FunctionCall<*>,
    parameter: FunctionParameter<*>,
    argument: FunctionCallArgument,
) : InvalidFunctionCallException(
    call,
    reason =
        "expected type ${parameter.type.simpleName} for parameter '${parameter.name}', " +
                "but ${argument.value::class.simpleName} found",
)